<template>
	<view>
		<block v-if="obj.id">
			<view class="bg">
				<view class="img-27">
					<video></video>
					<view class="display-a height-50">
						<view class="act" v-if="obj.releaseChannel!==2">用户头像</view>
						<view class="name" v-if="obj.releaseChannel!==2">用户昵称</view>
						<image v-if="obj.releaseChannel!==2" @click="tips()" class="img-29" src="../../static/29.png">
						</image>
					</view>
					<scroll-view class="frame" :scroll-y="true">
						<view class="color_FFFFFF">{{obj.activityDescription}}</view>
					</scroll-view>
				</view>
				<image v-if="obj.releaseChannel!==2" @click="tips()" class="img-28" src="../../static/28.png"></image>
				<image v-if="obj.releaseChannel==2" @click="videoFn()" class="img-joinActivity" src="../../static/joinActivity.png">
				</image>
			</view>
		</block>

	</view>
</template>

<script>
	export default {
		data() {
			return {
				id: '',
				obj: {},
				// 活动预览类型
				preview:''
			}
		},

		onLoad(options) {
			if (options.id) {
				this.id = options.id;
				this.detail();
			}
			if(options.preview){
					this.preview = options.preview;
			}
		},

		onShow() {

		},

		methods: {

			//活动详情
			async detail() {
				const result = await this.$http.get({
					url: this.$api.selectGetId,
					data: {
						id: this.id,
					}
				});
				if (result.code == 2000) {
					this.obj = result.data;
				} else {
					this.$sun.toast(result.msg, 'none');
				}
			},

			tips() {
				this.$sun.toast("此页面为活动预览页!", 'none');
			},
			
			// 如果是视频号需要跳到视频号活码页面
			videoFn(){
				
				// 判断一下当前是商家还是员工 如果是商家那么次页面为 预览页面
				console.log(uni.getStorageSync('types'))
				if(uni.getStorageSync('types')==1){
					this.tips() 
					return 
				}
				if(String(this.preview)==1&&uni.getStorageSync('types')==2){
					this.tips()
					return 
				}
				uni.navigateTo({
					url: '/pages/index/videoCode?id='+this.id
				})
			}

		}
	}
</script>

<style lang="scss">
	.frame {
		// border: 1px solid red;
		width: 640rpx;
		height: 420rpx;
		margin: 120rpx 48rpx 0;
	}

	.img-28 {
		width: 554rpx;
		height: 126rpx;
		margin-left: 98rpx;
	}
.img-joinActivity{
	width: 554rpx;
	height: 110rpx;
	margin-left: 98rpx;
}
	.name {
		font-size: 32rpx;
		color: #FFFFFF;
	}

	.act {
		width: 100rpx;
		height: 100rpx;
		border-radius: 100rpx;
		background-color: #a1a1a1;
		color: #FFFFFF;
		padding: 10rpx 20rpx;
		margin: 0 20rpx 0 60rpx;
	}

	.img-29 {
		width: 180rpx;
		height: 66rpx;
		margin-left: auto;
		margin-right: 60rpx;
	}

	uni-video {
		width: 598rpx;
		height: 336rpx;
		margin: 168rpx 48rpx 120rpx 70rpx;
		border-radius: 4rpx;
	}

	.img-27 {
		width: 718rpx;
		height: 1316rpx;
		background: url('~static/27.png');
		background-repeat: no-repeat;
		background-size: contain;
		margin: 0 16rpx 50rpx;
	}

	.height-50 {
		height: 100rpx
	}

	.bg {
		width: 750rpx;
		height: 1494rpx;
		background: url('~static/26.png');
		background-repeat: no-repeat;
		background-size: contain;
	}

	page {
		border-top: 0;
		background-color: #4F29D2;
		padding-top: 14rpx;
		padding-bottom: 20rpx;
	}
</style>